package com.dbqn.zhao.util;

import com.dbqn.zhao.service.BaseService;
import com.dbqn.zhao.service.StartServes;
import com.dbqn.zhao.service.XslxService;
import com.dbqn.zhao.service.impl.*;
import sun.rmi.registry.RegistryImpl;

public class ServiceFactory {

    //业务工厂类-------作用：帮忙创建对象

    //返回业务接口的实现类对象
    public BaseService getBean(){
        return new StartServesImpl();
    }

        public static BaseService getService(String key){
        if("start".equals(key)){
            return (BaseService) new StartServesImpl();
        }else if("login".equals(key)){
            return (BaseService) new LoginServiceIml();
        }else if ("register".equals(key)){
            return (BaseService) new RegisterServiceImpl();
        }else if ("xslx".equals(key)){
            return (BaseService) new XslxServiceImpl();
        }else if ("getnovel".equals(key)){
            return (BaseService) new GetNovelsServiceImpl();
        }else if ("sword".equals(key)){
            return (BaseService) new SwordsmanImpl();
        }

        return null;
        }

}
